<?php
//use common\Tools;
//use yii\web\Response;
//use yii\base\Event;

$config = [
    "components" => [
        "request" => [
//            'parsers' => [
//                'application/json' => 'yii\web\JsonParser',
//                'text/json' => 'yii\web\JsonParser',
//            ],
//            "csrfParam" => "_csrf-" . APP_ID,
        ],
        "user" => [
            "class" => 'api\rewrites\User',
            "identityClass" => 'api\models\db\ApiUsers',
        ],
//        'response' => [
//            'class' => Response::class,
//            //返回异常统一处理
//            'on '.Response::EVENT_BEFORE_SEND => function (Event $event) {
//                /** @var Response $sender */
//                $sender = $event->sender;
//                $sender->format = Response::FORMAT_JSON;
//                Yii::$app->response->headers->set('Access-Control-Allow-Origin', '*');
//            },
//        ],
    ],
    'modules' => [
        'guest' => 'api\modules\guest\GuestModule',
    ],
    'as token check' => [
        'class' => 'api\behaviors\TokenCheck',
        'except' => [
            'gii/*',
            'debug/*',
            'route/*',
            'guest/*',
        ],
    ],
    'params' => [],
];
return $config;
